
#include "TclCommand.h"
#include "UpfModel.h"
#include "Analyze.h"
#include <iostream>
#include <fstream>
#include <unistd.h>

int main(int argc, char *argv[])
{
    std::string upfTopFile;
    bool flag_error = false;
    bool flag_source = false;
    int opt;
    while ((opt = getopt(argc, argv, "esf:")) != EOF)
    {
        switch (opt) {
            case 'f':
                upfTopFile = optarg;
                break;
            case 'e':
                flag_error = true;
                break;
            case 's':
                flag_source = true;
                break;
        }
    }
    if (upfTopFile.empty()) {
        return -1;
    }
    UpfCommandMgr::getInstance()->readUpfFile(upfTopFile);
    //do power analysis;
    PwObjMgr* pom = PwObjMgr::getInstance();
    if(flag_error)
        pom->printError();
    if(flag_source)
        pom->printSource();
    PwObjMgr::getInstance()->clear();
    return 0;
}
